package com.example.javaspringweb.dao;

import com.example.javaspringweb.entity.UserDemo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("SELECT * FROM user WHERE username=#{username} AND userpassword=#{password}") //以#{}的方式表示sql中的参数
    UserDemo LoginNameAndPassword(@Param("username")String username, @Param("password")String password);//@param表示上面sql中的参数


    @Select("SELECT * FROM user")
    List<UserDemo> FindAllUser();

    @Select("INSERT INTO user (username, userpassword) VALUES (#{username}, #{userpassword})")
    List<UserDemo> AddUser(@Param("username") String username, @Param("userpassword") String userpassword);


//    @Select("update user ")





}
